<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-19 14:37:32
-->
<template>
  <!--1. 容器 -->
  <div ref="Bottom2_container" style="height: 95%"></div>
</template>
<script>
// 2. 导入图表构造函数
import { Bar } from '@antv/g2plot';
export default {
  mounted() {
    // 4. 在页面渲染完成后调用图表的渲染
    this.initChart();
  },
  methods:{
    // 3. 初始化图表
    initChart(){
      const data = [
        { year: 'tst', value: 38 },
        { year: 'pm10', value: 52 },
        { year: 'pm25', value: 61 },
        ];
        const bar = new Bar(this.$refs.Bottom2_container, {
        data,
        xField: 'value',
        yField: 'year',
        seriesField: 'year',
         legend: {
        position: 'top-left',
    },
  });

bar.render();
    }
  }
}
</script>